package com.guchenbo.bigdata.hive;

import java.sql.*;

public class HiveDemo {
    private static String driverName = "org.apache.hive.jdbc.HiveDriver";

    public static void main(String[] args) throws Exception {
        Class.forName(driverName);
        // get connection

        Connection con = DriverManager.getConnection("jdbc:hive2://vnode102:10000/gcb", "", "");
        PreparedStatement stmt = con.prepareStatement("select * from student");
        ResultSet rs = stmt.executeQuery();
        while (rs.next()) {
            System.out.println(rs.getString(1));
        }
        con.close();
    }
}
